\(\int (f+\frac {g}{x})^2 (A+B \log (e (\frac {a+b x}{c+d x})^n)) \, dx\) [2]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 32, antiderivative size = 263 \[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=A f^2 x-2 B f g n \log (x) \log \left (1+\frac {b x}{a}\right )+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}+\frac {(b c-a d) g^2 (a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{a (c+d x) \left (a-\frac {c (a+b x)}{c+d x}\right )}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}+2 B f g n \log (x) \log \left (1+\frac {d x}{c}\right )+\frac {B (b c-a d) g^2 n \log \left (a-\frac {c (a+b x)}{c+d x}\right )}{a c}-2 B f g n \operatorname {PolyLog}\left (2,-\frac {b x}{a}\right )+2 B f g n \operatorname {PolyLog}\left (2,-\frac {d x}{c}\right ) \]

[Out]

A*f^2*x-2*B*f*g*n*ln(x)*ln(1+b*x/a)+B*f^2*(b*x+a)*ln(e*((b*x+a)/(d*x+c))^n)/b+(-a*d+b*c)*g^2*(b*x+a)*(A+B*ln(e
*((b*x+a)/(d*x+c))^n))/a/(d*x+c)/(a-c*(b*x+a)/(d*x+c))+2*f*g*ln(x)*(A+B*ln(e*((b*x+a)/(d*x+c))^n))-B*(-a*d+b*c
)*f^2*n*ln(d*x+c)/b/d+2*B*f*g*n*ln(x)*ln(1+d*x/c)+B*(-a*d+b*c)*g^2*n*ln(a-c*(b*x+a)/(d*x+c))/a/c-2*B*f*g*n*pol
ylog(2,-b*x/a)+2*B*f*g*n*polylog(2,-d*x/c)

Rubi [A] (verified)

Time = 0.17 (sec) , antiderivative size = 263, normalized size of antiderivative = 1.00, number of steps used = 13, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2608, 2535, 31, 2553, 2351, 2545, 2354, 2438} \[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=2 f g \log (x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )+\frac {g^2 (a+b x) (b c-a d) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{a (c+d x) \left (a-\frac {c (a+b x)}{c+d x}\right )}+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {B f^2 n (b c-a d) \log (c+d x)}{b d}+\frac {B g^2 n (b c-a d) \log \left (a-\frac {c (a+b x)}{c+d x}\right )}{a c}-2 B f g n \operatorname {PolyLog}\left (2,-\frac {b x}{a}\right )-2 B f g n \log (x) \log \left (\frac {b x}{a}+1\right )+A f^2 x+2 B f g n \operatorname {PolyLog}\left (2,-\frac {d x}{c}\right )+2 B f g n \log (x) \log \left (\frac {d x}{c}+1\right ) \]

[In]

Int[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x - 2*B*f*g*n*Log[x]*Log[1 + (b*x)/a] + (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b + ((b*c - a*d
)*g^2*(a + b*x)*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/(a*(c + d*x)*(a - (c*(a + b*x))/(c + d*x))) + 2*f*g*Lo
g[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + 2*B*f*g*n*Log[x]*Log[
1 + (d*x)/c] + (B*(b*c - a*d)*g^2*n*Log[a - (c*(a + b*x))/(c + d*x)])/(a*c) - 2*B*f*g*n*PolyLog[2, -((b*x)/a)]
 + 2*B*f*g*n*PolyLog[2, -((d*x)/c)]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2351

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_) + (e_.)*(x_)^(r_.))^(q_), x_Symbol] :> Simp[x*(d + e*x^r)^(q +
 1)*((a + b*Log[c*x^n])/d), x] - Dist[b*(n/d), Int[(d + e*x^r)^(q + 1), x], x] /; FreeQ[{a, b, c, d, e, n, q,
r}, x] && EqQ[r*(q + 1) + 1, 0]

Rule 2354

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[Log[1 + e*(x/d)]*((a +
b*Log[c*x^n])^p/e), x] - Dist[b*n*(p/e), Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[
{a, b, c, d, e, n}, x] && IGtQ[p, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2535

Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*(B_.))^(p_.), x_Symbol] :> Simp[(a +
 b*x)*((A + B*Log[e*((a + b*x)/(c + d*x))^n])^p/b), x] - Dist[B*n*p*((b*c - a*d)/b), Int[(A + B*Log[e*((a + b*
x)/(c + d*x))^n])^(p - 1)/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, A, B, n}, x] && NeQ[b*c - a*d, 0] && IGtQ
[p, 0]

Rule 2545

Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*(B_.))/((f_.) + (g_.)*(x_)), x_Symbo
l] :> Simp[Log[f + g*x]*((A + B*Log[e*((a + b*x)/(c + d*x))^n])/g), x] + (-Dist[b*B*(n/g), Int[Log[f + g*x]/(a
 + b*x), x], x] + Dist[B*d*(n/g), Int[Log[f + g*x]/(c + d*x), x], x]) /; FreeQ[{a, b, c, d, e, f, g, A, B, n},
 x] && NeQ[b*c - a*d, 0]

Rule 2553

Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*(B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m
_.), x_Symbol] :> Dist[b*c - a*d, Subst[Int[(b*f - a*g - (d*f - c*g)*x)^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m +
 2)), x], x, (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] && NeQ[b*c - a*d, 0] && Inte
gerQ[m] && IGtQ[p, 0]

Rule 2608

Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.)*(RGx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*
RFx^p])^n, RGx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, p}, x] && RationalFunctionQ[RFx, x] && RationalF
unctionQ[RGx, x] && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (f^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )+\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x^2}+\frac {2 f g \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}\right ) \, dx \\ & = f^2 \int \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx+(2 f g) \int \frac {A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{x} \, dx+g^2 \int \frac {A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{x^2} \, dx \\ & = A f^2 x+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )+\left (B f^2\right ) \int \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right ) \, dx+\left ((b c-a d) g^2\right ) \text {Subst}\left (\int \frac {A+B \log \left (e x^n\right )}{(-a+c x)^2} \, dx,x,\frac {a+b x}{c+d x}\right )-(2 b B f g n) \int \frac {\log (x)}{a+b x} \, dx+(2 B d f g n) \int \frac {\log (x)}{c+d x} \, dx \\ & = A f^2 x-2 B f g n \log (x) \log \left (1+\frac {b x}{a}\right )+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}+\frac {(b c-a d) g^2 (a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{a (c+d x) \left (a-\frac {c (a+b x)}{c+d x}\right )}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )+2 B f g n \log (x) \log \left (1+\frac {d x}{c}\right )-\frac {\left (B (b c-a d) f^2 n\right ) \int \frac {1}{c+d x} \, dx}{b}+(2 B f g n) \int \frac {\log \left (1+\frac {b x}{a}\right )}{x} \, dx-(2 B f g n) \int \frac {\log \left (1+\frac {d x}{c}\right )}{x} \, dx+\frac {\left (B (b c-a d) g^2 n\right ) \text {Subst}\left (\int \frac {1}{-a+c x} \, dx,x,\frac {a+b x}{c+d x}\right )}{a} \\ & = A f^2 x-2 B f g n \log (x) \log \left (1+\frac {b x}{a}\right )+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}+\frac {(b c-a d) g^2 (a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{a (c+d x) \left (a-\frac {c (a+b x)}{c+d x}\right )}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}+2 B f g n \log (x) \log \left (1+\frac {d x}{c}\right )+\frac {B (b c-a d) g^2 n \log \left (a-\frac {c (a+b x)}{c+d x}\right )}{a c}-2 B f g n \text {Li}_2\left (-\frac {b x}{a}\right )+2 B f g n \text {Li}_2\left (-\frac {d x}{c}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 217, normalized size of antiderivative = 0.83 \[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=A f^2 x+\frac {B f^2 (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b}-\frac {g^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{x}+2 f g \log (x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B (b c-a d) f^2 n \log (c+d x)}{b d}+\frac {B g^2 n ((b c-a d) \log (x)-b c \log (a+b x)+a d \log (c+d x))}{a c}-2 B f g n \left (\log (x) \left (\log \left (1+\frac {b x}{a}\right )-\log \left (1+\frac {d x}{c}\right )\right )+\operatorname {PolyLog}\left (2,-\frac {b x}{a}\right )-\operatorname {PolyLog}\left (2,-\frac {d x}{c}\right )\right ) \]

[In]

Integrate[(f + g/x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]),x]

[Out]

A*f^2*x + (B*f^2*(a + b*x)*Log[e*((a + b*x)/(c + d*x))^n])/b - (g^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/x
+ 2*f*g*Log[x]*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*(b*c - a*d)*f^2*n*Log[c + d*x])/(b*d) + (B*g^2*n*((
b*c - a*d)*Log[x] - b*c*Log[a + b*x] + a*d*Log[c + d*x]))/(a*c) - 2*B*f*g*n*(Log[x]*(Log[1 + (b*x)/a] - Log[1
+ (d*x)/c]) + PolyLog[2, -((b*x)/a)] - PolyLog[2, -((d*x)/c)])

Maple [F]

\[\int \left (f +\frac {g}{x}\right )^{2} \left (A +B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right )\right )d x\]

[In]

int((f+g/x)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n)),x)

[Out]

int((f+g/x)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n)),x)

Fricas [F]

\[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\int { {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )} {\left (f + \frac {g}{x}\right )}^{2} \,d x } \]

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="fricas")

[Out]

integral((A*f^2*x^2 + 2*A*f*g*x + A*g^2 + (B*f^2*x^2 + 2*B*f*g*x + B*g^2)*log(e*((b*x + a)/(d*x + c))^n))/x^2,
 x)

Sympy [F]

\[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\int \frac {\left (A + B \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}\right ) \left (f x + g\right )^{2}}{x^{2}}\, dx \]

[In]

integrate((f+g/x)**2*(A+B*ln(e*((b*x+a)/(d*x+c))**n)),x)

[Out]

Integral((A + B*log(e*(a/(c + d*x) + b*x/(c + d*x))**n))*(f*x + g)**2/x**2, x)

Maxima [F]

\[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\int { {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )} {\left (f + \frac {g}{x}\right )}^{2} \,d x } \]

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="maxima")

[Out]

B*f^2*n*(a*log(b*x + a)/b - c*log(d*x + c)/d) - B*g^2*n*(b*log(b*x + a)/a - d*log(d*x + c)/c - (b*c - a*d)*log
(x)/(a*c)) + B*f^2*x*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f^2*x - 2*B*f*g*integrate(-(log((b*x + a)^n) -
 log((d*x + c)^n) + log(e))/x, x) + 2*A*f*g*log(x) - B*g^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n)/x - A*g^2/x

Giac [F]

\[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\int { {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )} {\left (f + \frac {g}{x}\right )}^{2} \,d x } \]

[In]

integrate((f+g/x)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x, algorithm="giac")

[Out]

integrate((B*log(e*((b*x + a)/(d*x + c))^n) + A)*(f + g/x)^2, x)

Mupad [F(-1)]

Timed out. \[ \int \left (f+\frac {g}{x}\right )^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\int {\left (f+\frac {g}{x}\right )}^2\,\left (A+B\,\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\right ) \,d x \]

[In]

int((f + g/x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)),x)

[Out]

int((f + g/x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)), x)